<?php require ('./order.php'); ?>
<?php

session_start();  
//echo $_SESSION['UserName'];
   if(!empty($_POST['U_CardCode'])){ $U_CardCode=$_POST['U_CardCode']; } 
   if(!empty($_POST['sumqty'])){ $sumqty=$_POST['sumqty']; } 
 if(!empty($_POST['U_ItemCode'])){ $U_ItemCode=$_POST['U_ItemCode']; } 
  if(!empty($_POST['U_CitemCd'])){ $U_CitemCd=$_POST['U_CitemCd']; }
    if(!empty($_POST['Susers'])){ $Susers=$_POST['Susers']; } 
  if(!empty($_POST['RepalceType'])){ $RepalceType=$_POST['RepalceType']; }
   if(!empty($_POST['U_OStatus'])){ $U_OStatus=$_POST['U_OStatus']; }
  
  /*  U_CardName:$bb,
      sumqty:$bbb,
      U_ItemCode:$h,
      U_CitemCd:$hh,
      Susers:$a, 
      RepalceType:$b,
      U_OStatus:$s,*/
  //ECHO $RepalceType;

 if($RepalceType=='D1'||$RepalceType=='D2'||$RepalceType=='D3'){

  // $sql= "exec [AX_Replace_Order_Update] '".$U_OrderId."','".$Susers."','".$_SESSION['UserName']."','Susers'";
  // $ddf=odbc_exec($sqlconnection,$sql);
   //echo $sql;
   
   //odbc_close($sqlconnection);
   $sql1= "exec[AX_Replace_Order_Grouped_Update] '".$U_CardCode."','".$U_ItemCode."','".$U_CitemCd."','".$sumqty."','".$RepalceType."','".$U_OStatus."','".$Susers."','".$_SESSION['UserName']."'";
   $ddf=odbc_exec($sqlconnection,$sql1);
   //echo $sql1;
  }
  //if($RepalceType='D3'){
    // $sql= "exec [AX_Replace_Order_Update] '".$U_OrderId."','".$Susers."','".$_SESSION['UserName']."','Susers'";
  // $ddf=odbc_exec($sqlconnection,$sql);
   //echo $sql;
 // }
  if(isset($U_OrderId)){
   $sql2= "exec[AX_Replace_Order_Grouped_Update] '".$U_CardCode."','".$U_ItemCode."','".$U_CitemCd."','".$sumqty."','".$RepalceType."','".$U_OStatus."','".$Susers."','".$_SESSION['UserName']."'";
  //echo $sql2;
   $ddfF=odbc_exec($sqlconnection,$sql2);

   }
   odbc_close($sqlconnection);
  // echo '<option value="'.$row5[$i]['OptionV'].'" >'.iconv("GB18030","utf-8//IGNORE",$row5[$i]['OptionDES']).'</option>';
?>
